package com.phkj.utils;


import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;

/**
 * @ClassName MqUtils
 * @Description TODO
 * @Author wlj
 * @Date 2018/7/13  15:02
 * @Version 1.0
 */
public class ConnectionUtil {

    public  static Connection getConnection(){
        //创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        //设置RabbitMQ相关信息
        factory.setHost("localhost");
         // factory.setUsername("guest");
        //factory.setPassword("guest");
       //  factory.setPort(5672);
        //创建一个新的连接
        try {
            return factory. newConnection();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
